﻿ @model List<ThesisSystem.Models.Thesis>

<!DOCTYPE html>
<html>
<head>
    <title>test</title>
    <script src="../../Scripts/jquery.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.unobtrusive-ajax.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery.unobtrusive-ajax.min.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-min.js" type="text/javascript"></script>
</head>
<body>
    <div>
      @*  @{ var grid = new WebGrid(source: Model, canPage: true, rowsPerPage: 2);
            @grid.GetHtml(tableStyle: "ContactTB", headerStyle: "ContactHD", columns: grid.Columns(grid.Column("StudentID", "用户名", style: "UserName",   format: @<b>@item.UserName</b>),
                   grid.Column("ThesisTitle", "留言内容", style: "Content", canSort: false), 
            grid.Column("UploadData", "留言时间", style: "Addtime"), 
            grid.Column(style: "edit", format: (item) => Html.ActionLink("编辑", "Edit", new { id = item.ID })), 
            grid.Column(style: "delete", format: (item) => Html.ActionLink("删除", "Delete", new { id = item.ID }))));}*@





  @using (Ajax.BeginForm("test", "Theses", new AjaxOptions { UpdateTargetId = "DivGrid" }))
  {
      IDictionary<string, string> searchConditions = new Dictionary<string, string>();

      if (TempData["SearchConditions"] != null)
      {
          searchConditions = TempData["SearchConditions"] as Dictionary<string, string>;
      }

      this.TempData["SearchConditions"] = searchConditions;

      string studentId = searchConditions.Keys.Contains("StudentID") ? searchConditions["StudentID"] : string.Empty;
      string thesisTitle = searchConditions.Keys.Contains("ThesisTitle") ? searchConditions["ThesisTitle"] : string.Empty;
     
    <div>
         @Html.Encode("Student ID: ")
    </div>
    @Html.TextBox("StudentID", @studentId)
     <div>
         @Html.Encode("thesisTitle: ")
     </div>
     @Html.TextBox("ThesisTitle", @thesisTitle)
     <br/>
      <input type="submit"  value="查询"/>
      
 
      var grid = new WebGrid(source: Model,
      fieldNamePrefix: "grid_",
      defaultSort: "StudentId",
      canPage: true,
     canSort: true,
      ajaxUpdateContainerId: "DivGrid",
      pageFieldName: "paging",
     sortFieldName: "sortField",
      rowsPerPage: 4);

     <div id="DivGrid">
     @grid.GetHtml(
         columns: grid.Columns(
             grid.Column("StudentID", "Student ID"),
            grid.Column("ThesisTitle", "Thesis Title"),
                  grid.Column("UploadDate", "Upload Data"),
                   grid.Column("ThesisType", "Thesis Type"),
                   grid.Column("ReviewStatus", "Review Satus")
         )
     )
     </div>
     <h2>
     Page Count:
     @Html.Encode(grid.PageCount)
     <br/>
     Total Record:
    @Html.Encode(grid.TotalRowCount)
    </h2>
     @Html.Encode(grid.FieldNamePrefix)
  }

    </div>
</body>
</html>
